package data;

public class Vector2D implements Data<Vector2D>
{
	public Vector2D(double x, double y)
	{
		this.x = x;
		this.y = y;
	}
	
	@Override
	public String toString()
	{
		return "("+x+","+y+")";
	}

	@Override
	public Vector2D add(Vector2D other) {
		return new Vector2D(x+other.x,y+other.y);
	}

	@Override
	public double getDistance(Vector2D d) 
	{
		return Math.sqrt((x-d.x)*(x-d.x)+(y-d.y)*(y-d.y));
	}

	@Override
	public Vector2D getZero() {
		return new Vector2D(0,0);
	}

	@Override
	public Vector2D scale(double factor) 
	{
		return new Vector2D(x*factor,y*factor);
	}
	
	double x;
	double y;

}
